package com.livesource.client.web.project;

import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.livesource.client.model.project.Project;
import com.livesource.client.utilities.FormField;

/**
 * 
 * @UserInterface
 */
public class ProjectForm extends VerticalPanel {

	public static final TextBox name = new TextBox();
	public static RepositoryTypeList repositoryType;
	public static final TextBox url = new TextBox();

	public ProjectForm(Project project) {

		this.setSpacing(30);

		name.setWidth("300px");
		name.setValue(project.getName());
		this.add(FormField.getFormField("Project Name", name));

		repositoryType = new RepositoryTypeList(project.getRepositoryType());
		this.add(FormField.getFormField("Repository Type", repositoryType));

		url.setWidth("500px");
		url.setValue(project.getRepositoryURL());
		this.add(FormField.getFormField("Repository URL", url));

		this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

		HorizontalPanel hp = new HorizontalPanel();

		hp.setWidth("300px");

		hp.add(new ButtonSave(project));

		this.add(hp);
	}
}
